

#include <exception>
#include <iostream>


class NewException : public std::exception
{
private:
	std::string mssg;
public:
	~NewException() {}
	NewException(std::string mssg)
	{
		this->mssg = mssg;
	}
	virtual const char* what() const throw()  // do not forget "const throw"
	{
		return this->mssg.c_str();
	}
};

int main()
{
	try
	{
		throw NewException("you got a error !!!");
	}
	catch (std::exception& e)
	{
		std::cout << e.what() << std::endl;
	}
}
